using System.Data;
using System.Data.SqlClient;
using VanTaiProperty;
namespace VanTaiData
{
    public class clsTMDiaryTransferOrderController
    {
        private clsConnect cls = new clsConnect();

        #region[Get-Data]
        public DataTable BindGirdTMDiaryTransferOrder()
        {
            return cls.BindGridData("sp_TMDiaryTransferOrder");
        }
        public DataTable BindGirdTMDiaryTransferOrder_Detail_Edit(int id)
        {
            return cls.LayDuLieuParameter("sp_TMDiaryTransferOrder_Detail_Edit", "@DiaryTrans_ID", id);
        }
        #endregion

        #region[Insert-Update-Delete]
        public bool InsertTMDiaryTransferOrder(clsTMDiaryTransferOrderProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@DiaryTrans_Date", data.DiaryTrans_Date);
            cls.AddParameter("@DiaryTrans_Vehicle_ID", data.DiaryTrans_Vehicle_ID);
            cls.AddParameter("@DiaryTrans_Member_ID", data.DiaryTrans_Member_ID);
            cls.AddParameter("@DiaryTrans_From_ID", data.DiaryTrans_From_ID);
            cls.AddParameter("@DiaryTrans_To_ID", data.DiaryTrans_To_ID);
            cls.AddParameter("@DiaryTrans_Log", data.DiaryTrans_Log);
            cls.AddParameter("@DiaryTrans_Note", data.DiaryTrans_Note);
            cls.ExecuteNonQuery("sp_TMDiaryTransferOrder_Insert");
            return true;
        }
        public bool UpdateTMDiaryTransferOrder(clsTMDiaryTransferOrderProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@DiaryTrans_ID", data.DiaryTrans_ID);
            cls.AddParameter("@DiaryTrans_Date", data.DiaryTrans_Date);
            cls.AddParameter("@DiaryTrans_Vehicle_ID", data.DiaryTrans_Vehicle_ID);
            cls.AddParameter("@DiaryTrans_Member_ID", data.DiaryTrans_Member_ID);
            cls.AddParameter("@DiaryTrans_From_ID", data.DiaryTrans_From_ID);
            cls.AddParameter("@DiaryTrans_To_ID", data.DiaryTrans_To_ID);
            cls.AddParameter("@DiaryTrans_Log", data.DiaryTrans_Log);
            cls.AddParameter("@DiaryTrans_Note", data.DiaryTrans_Note);
            cls.ExecuteNonQuery("sp_TMDiaryTransferOrder_Update");
            return true;
        }
        public bool DeleteTMDiaryTransferOrder(int id)
        {
            cls.Delete("sp_TMDiaryTransferOrder_Delete", "@DiaryTrans_ID", id);
            return true;
        }
        #endregion

        #region[Search-Fillter]
        public DataTable Search(string keywords)
        {
            return cls.Search("sp_TMDiaryTransferOrder_Search", "@KEYWORDS", keywords);
        }
        public DataTable Fillter_Date(string DateBegin, string EndBegin)
        {
            return cls.FillterDay("sp_TMDiaryTransferOrder_Fillter_Date", DateBegin, EndBegin);
        }
        #endregion
    }
}